//
//  ESCellTopView.m
//  Eyeshot
//
//  Created by admin on 15/7/3.
//  Copyright (c) 2015年 eyeshot. All rights reserved.
//

#import "ESCellTopView.h"

@implementation ESCellTopView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {

        ESCellUserProfile *userProfile = [ESCellUserProfile cellUserProfile];
        UIButton *follow = [UIButton buttonWithType:UIButtonTypeCustom];
        [follow setImage:[UIImage imageNamed:@"cellFollowIcon"] forState:UIControlStateNormal];
        [self addSubview:userProfile];
        [self addSubview:follow];
        _follow = follow;
        _userProfile = userProfile;
    }
    return self;
}

+ (instancetype)cellTopView {
    return [[ESCellTopView alloc] init];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    CGFloat width = self.frame.size.width;
    CGFloat height = self.frame.size.height;
    _userProfile.frame = CGRectMake(ZERO, ZERO, 0.5 * width, height);
    _follow.frame = CGRectMake(0.5 * width, ZERO, 0.5 * width, height);
    _follow.imageEdgeInsets = UIEdgeInsetsMake(2 * kHorizen, 0.5 * width - 8 * kHorizen, 0, 0);
//    _userProfile.backgroundColor = [UIColor cyanColor];
//    _follow.backgroundColor = [UIColor greenColor];
}
@end
